package com.frx.leetcode.classify.binarytree;

/**
 * @author ：frx
 * @date ：Created in 2019/11/14 23:14
 * @description：ToDO
 * @modified By：
 * @version: ToDO
 */
public class MaxDepth {
    public static void main(String[] args){

    }

    public static int maxDepth(TreeNode root){
        if (root == null){
            return 0;
        }
        return Math.max(maxDepth(root.left),maxDepth(root.right)) + 1;
    }

    class TreeNode{
        int val;
        TreeNode left;
        TreeNode right;
    }
}
